
// this is a sample to show how you could convert soap xml into an array of objects
// you will need to find your own namespace identifier in your raw soap response
// by brandon flowers

package alducente.xml
{
	public class NamespaceHelper  
	{
		public function NamespaceHelper() {}
			
		public static function getMomentObjArray(serviceResponseXML:XML, requestName):Array
		{
			serviceResponseXML.soap.registerUserResponse.registerUserResult.toString();
			
			var envelope:XML = serviceResponseXML;
			var soapNamespace:Namespace = envelope.namespace("soap");
			var smurfsNamespace:Namespace = new Namespace("http://your.namespace.here/");
			var enemyXMLList:XMLList = envelope.soapNamespace::Body.smurfsNamespace::[requestName + "Response"].smurfsNamespace::["SMURFS"].smurfsNamespace::["Enemies"].smurfsNamespace::["enemy"];
			
                        var objArray:Array = new Array();
			
			for each ( var enemy:XML in enemyXMLList )
			{
				var enemyObj:Object = new Object();	
				
				enemyObj:Object.firstName = enemy.smurfsNamespace::EnemyName.toString();
				enemyObj:Object.email = enemy.smurfsNamespace::EnemyEmail.toString();
				enemyObj:Object.status = enemy.smurfsNamespace::EnemyStatus.toString();
				enemyObj:Object.photoPath = enemy.smurfsNamespace::PicturePath.toString();
				enemyObj:Object.timestamp = enemy.smurfsNamespace::TimeStamp.toString();
				enemyObj:Object.browser = enemy.smurfsNamespace::BrowserInfo.toString();
							
				objArray.push(enemyObj:Object)
			}
			
			
			return objArray;
		}
		
		
	}
	
}